''' <summary>
''' Base class for all event args used for the file manager portion of IWeb.
''' </summary>
''' <remarks>
''' Can override the status field to provide custom handling of the event status.
''' ITLackey 10.29.07
''' </remarks>
Public Class FileManagerEventArgs
    Inherits System.EventArgs

    Private headerField As New IWeb.IWebAuthendicationHeader()
    Protected folderIdField As Integer = -1
    Private statusField As String = String.Empty
    Private hasErrorField As Boolean = False

    Public Sub New()

    End Sub

    Public Sub New(ByVal header As IWeb.IWebAuthendicationHeader)
        Me.Header = header

    End Sub

    Public Property Header() As IWeb.IWebAuthendicationHeader
        Get
            Return headerField
        End Get
        Set(ByVal value As IWeb.IWebAuthendicationHeader)
            headerField = value
        End Set
    End Property


    Public ReadOnly Property FolderId() As Integer
        Get
            Return folderIdField
        End Get
    End Property

    Public Overridable Property Status() As String
        Get
            Return statusField
        End Get
        Set(ByVal value As String)
            Me.statusField = value
        End Set
    End Property

    Public Property HasError() As Boolean
        Get
            Return hasErrorField
        End Get
        Set(ByVal value As Boolean)
            Me.hasErrorField = value
        End Set
    End Property

End Class


Friend Class DeleteFilesEventArgs
    Inherits FileManagerEventArgs


    Private fileNameField As String = String.Empty

    Private fileIdsField() As Integer


    Public Sub New(ByVal header As IWeb.IWebAuthendicationHeader, ByVal fileIds() As Integer)
        MyBase.Header = header
        Me.fileIdsField = fileIds

        MyBase.Status = String.Empty
    End Sub


    Public ReadOnly Property FileIds() As Integer()
        Get
            Return fileIdsField
        End Get
    End Property

    Public Overrides Property Status() As String
        Get
            If String.IsNullOrEmpty(MyBase.Status) Then

                Return String.Format("{0} files deleted.", Me.fileIdsField.Length)

            Else
                Return MyBase.Status

            End If

        End Get
        Set(ByVal value As String)
            MyBase.Status = value
        End Set
    End Property

End Class


Friend Class FileTransferEventArgs
    Inherits FileManagerEventArgs


    Private fileNameField As String = String.Empty

    Public Sub New(ByVal header As IWeb.IWebAuthendicationHeader, ByVal folderId As Integer, ByVal fileName As String)
        MyBase.Header = header
        MyBase.folderIdField = folderId
        Me.fileNameField = fileName

    End Sub

    Public ReadOnly Property FileName() As String
        Get
            Return fileNameField
        End Get
    End Property


    Public Overrides Property Status() As String
        Get
            If String.IsNullOrEmpty(MyBase.Status) Then

                Return String.Format("{0} transfered.", Me.FileName)

            Else
                Return MyBase.Status

            End If

        End Get
        Set(ByVal value As String)
            MyBase.Status = value
        End Set
    End Property

End Class


Friend Class DownloadFileEventArgs
    Inherits FileManagerEventArgs


    Private fileNameField As String = String.Empty
    Private fileIdField As Integer = -1

    Public Sub New(ByVal header As IWeb.IWebAuthendicationHeader, ByVal fileId As Integer, ByVal fileName As String)
        MyBase.Header = header
        Me.fileIdField = fileId
        Me.fileNameField = fileName

    End Sub

    Public ReadOnly Property FileId() As Integer
        Get
            Return fileIdField
        End Get
    End Property
    Public ReadOnly Property FileName() As String
        Get
            Return fileNameField
        End Get
    End Property


    Public Overrides Property Status() As String
        Get
            If String.IsNullOrEmpty(MyBase.Status) Then

                Return String.Format("{0} downloaded.", Me.FileName)

            Else
                Return MyBase.Status

            End If

        End Get
        Set(ByVal value As String)
            MyBase.Status = value
        End Set
    End Property

End Class


Public Class GetFileInfoEventArgs
    Inherits FileManagerEventArgs

    Private fileField As IWeb.IWebFileInfo
    Private fileIdField As Integer = -1

    Sub New(ByVal header As IWeb.IWebAuthendicationHeader, ByVal folderId As Integer, ByVal fileId As Integer)

        MyBase.Header = header
        MyBase.folderIdField = folderId
        Me.fileIdField = fileId


    End Sub

    Public Property File() As IWeb.IWebFileInfo
        Get
            Return fileField
        End Get
        Set(ByVal value As IWeb.IWebFileInfo)
            fileField = value
        End Set
    End Property

    Public ReadOnly Property FileId() As Integer
        Get
            Return fileIdField
        End Get
    End Property



End Class


Public Class GetFilesEventArgs
    Inherits FileManagerEventArgs

    Private filesField As List(Of IWeb.IWebFileInfo)

    Sub New(ByVal header As IWeb.IWebAuthendicationHeader, ByVal folderId As Integer)

        MyBase.folderIdField = folderId
        MyBase.Header = header

    End Sub

    Public Property Files() As List(Of IWeb.IWebFileInfo)
        Get
            Return filesField
        End Get
        Set(ByVal value As List(Of IWeb.IWebFileInfo))
            filesField = value
        End Set
    End Property



End Class

Public Class GetFoldersEventArgs
    Inherits FileManagerEventArgs

    Private foldersField As List(Of IWeb.IWebFolderInfo)

    Sub New(ByVal header As IWeb.IWebAuthendicationHeader, ByVal folderId As Integer)
        MyBase.Header = header

        MyBase.folderIdField = folderId

    End Sub

    Public Property Folders() As List(Of IWeb.IWebFolderInfo)
        Get
            Return foldersField
        End Get
        Set(ByVal value As List(Of IWeb.IWebFolderInfo))
            foldersField = value
        End Set
    End Property

End Class


Public Class NewFolderEventArgs
    Inherits FileManagerEventArgs

    Private newFolderNameField As String

    Public Sub New(ByVal header As IWeb.IWebAuthendicationHeader, ByVal parentFolderId As Integer, ByVal newFolderName As String)
        MyBase.Header = header
        MyBase.folderIdField = parentFolderId
        Me.newFolderNameField = newFolderName

    End Sub

    Public ReadOnly Property NewFolderName() As String
        Get
            Return newFolderNameField
        End Get
    End Property


    Public Overrides Property Status() As String
        Get
            If String.IsNullOrEmpty(MyBase.Status) Then

                Return String.Format("{0} created.", Me.NewFolderName)

            Else
                Return MyBase.Status

            End If

        End Get
        Set(ByVal value As String)
            MyBase.Status = value
        End Set
    End Property
End Class
